﻿using Engine.Graphics.Shaders.Wr2Shaders;
using SharpDX;
using SharpDX.Direct3D11;
using System.Diagnostics;
using System.Windows.Forms;

namespace Engine.Graphics
{
    public class PerformanceTest
    {
        #region Public Methods

        public static void TestEffectPerformance(Device device)
        {
            Stopwatch sw = new Stopwatch();
            string shaderDirectory = Application.StartupPath + "\\shaders";
            Matrix matrix1 = Matrix.Identity;
            Matrix matrix2 = Matrix.Identity;
            Vector3 cameraPosition = Vector3.Zero;

            Material000[] materials = new Material000[100];
            for (int i = 0; i < materials.Length; i++)
            {
                materials[i] = new Material000(device, shaderDirectory);
            }

            sw.Start();

            for (int m = 0; m < 1000; m++)
            {
                foreach (var material in materials)
                {
                    //material.UpdateValues(matrix1, matrix2, cameraPosition);
                    throw new System.Exception("Erstmal bei der umstellung zu directx11 rausgenommen");
                    //material.Effect.Begin();
                    //material.Effect.BeginPass(0);
                    //material.Effect.EndPass();
                    //material.Effect.End();
                }
            }

            sw.Stop();

            MessageBox.Show("Elapsed Time: " + sw.Elapsed.ToString());
            //Application.Exit();
        }

        #endregion Public Methods
    }
}